using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class EntityMap : EntityTypeConfiguration<Entity>
    {
        public EntityMap()
        {
            // Primary Key
            this.HasKey(t => t.ENTITY1);

            // Properties
            this.Property(t => t.DESC)
                .HasMaxLength(50);

            this.Property(t => t.ENTITY1)
                .IsRequired()
                .HasMaxLength(4);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Entity");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.ENTITY1).HasColumnName("ENTITY");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
        }
    }
}
